//
//  YMSComposeButton.swift
//  YMSWeibo
//
//  Created by 杨茂盛 on 2016/11/21.
//  Copyright © 2016年 杨茂盛. All rights reserved.
//

import UIKit
let btnImageWidth:CGFloat = 80
let btnHeight:CGFloat = 110

class YMSComposeButton: UIButton {
//自定义按钮 才能修改btn图片和文字的位置
    //重写rect方法
    override init(frame: CGRect) {
        super.init(frame: frame)
        self.titleLabel?.textAlignment = .center
        self.titleLabel?.font = UIFont.systemFont(ofSize: 13)
        self.setTitleColor(UIColor.darkGray, for: .normal)
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    override func titleRect(forContentRect contentRect: CGRect) -> CGRect {
        return CGRect(x: 0, y: btnImageWidth, width: btnImageWidth, height: btnHeight - btnImageWidth)
    }
    override func imageRect(forContentRect contentRect: CGRect) -> CGRect {
        return CGRect(x: 0, y: 0, width: btnImageWidth, height:btnImageWidth)
    }
    
}
